<template>
  <div class="components-container">
    <!-- 编辑 -->
    <sweet-modal ref="dialog" class="dialog" :sweetModalMaxWidth="pageWidth">
      <h3>{{title}}</h3>
      <div :style="{maxHeight:maxHeight+'px'}" style="overflow:auto;">
        <fieldset class="layui-elem-field layui-field-title">
          <legend>死者信息</legend>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label text-danger">逝者类型<span class="text-danger">*</span></label>
              <div class="layui-input-inline">
                <el-select v-model="regData.REGBONETYPE" :disabled="noshow" >
                  <el-option v-for="item in szlx" :key="item.CODNAME" :label="item.CODALIAS" :value="item.CODNAME"  :disabled="item.disabled">
                  </el-option>
                </el-select>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">到馆时间</label>
              <div class="layui-input-inline">
                <el-date-picker v-date type="datetime" v-model="regDataEexend.regDataTime" format="yyyy-MM-dd HH:mm"></el-date-picker>
              </div>
            </div>
           <div class="layui-inline">
              <label class="layui-form-label">逝者性别</label>
              <div class="layui-input-inline">
                <el-select v-model="regData.REGSEX" filterable>
                  <el-option v-for="item in xblx" :key="item.CODNAME" :label="item.CODALIAS" :value="item.CODNAME">
                  </el-option>
                </el-select>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">证件类型</label>
              <div class="layui-input-inline">
                <el-select v-model="regData.REGCARDTYPE" filterable>
                  <el-option v-for="item in sfzjlx" :key="item.CODNAME" :label="item.CODALIAS" :value="item.CODNAME">
                  </el-option>
                </el-select>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">逝者姓名</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGNAME"></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">证件号码</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGCARDNO" @change="(value) => identityNumber(value)"></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">详细地址</label>
              <div class="layui-input-inline">
                <el-input class="longertext" placeholder="请输入内容" v-model="regData.REGDETAILADDRESS">
                </el-input>
              </div>
            </div>
           
          </div>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">出生日期</label>
              <div class="layui-input-inline">
                <el-date-picker v-date v-model="regDataEexend.RegBirthDate" type="date" @change="(value) => birthdaydata(value)"></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">逝者年龄</label>
              <div class="layui-input-inline">
                <el-input-number v-model="regData.REGAGE" :min="0"></el-input-number>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">死亡原因<span class="text-danger">*</span></label>
              <div class="layui-input-inline">
                <el-cascader :options="cause" v-model="cauinfo" filterable>
                </el-cascader>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">死亡日期</label>
              <div class="layui-input-inline">
                <el-date-picker v-date type="date" v-model="regDataEexend.regDeathDate"></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">火化日期</label>
              <div class="layui-input-inline">
                <el-date-picker v-date type="date" placeholder="选择日期时间" v-model="regDataEexend.regCremationDate"></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">排队序号</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGDAYNUM" :min="0" readonly></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">民族</label>
              <div class="layui-input-inline">
                <el-select v-model="regData.REGNATION">
                  <el-option v-for="item in mz" :key="item.CODNAME" :label="item.CODALIAS" :value="item.CODNAME">
                  </el-option>
                </el-select>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">户籍类别</label>
              <div class="layui-input-inline">
                <el-select v-model="regData.REGHOUSEHOLDTYPE">
                  <el-option v-for="item in hjlblx" :key="item.CODNAME" :label="item.CODALIAS" :value="item.CODNAME">
                  </el-option>
                </el-select>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">户籍地址</label>
              <div class="layui-input-inline">
                <el-cascader :options="household" v-model="ctyLists" filterable :show-all-levels="false" change-on-select>
                </el-cascader>
              </div>
            </div>
            <!-- <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">统计地点<span class="text-danger">*</span></label>
              <div class="layui-input-inline">
                <el-cascader :options="area" v-model="carryArea" filterable :show-all-levels="false" change-on-select>
                </el-cascader>
              </div>
            </div>
          </div>
          <fieldset class="layui-elem-field layui-field-title">
            <legend>家属信息</legend>
            <div class="layui-field-box">
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label">家属性别</label>
                  <div class="layui-input-inline">
                    <el-select v-model="regData.REGHANDSEX">
                      <el-option v-for="item in xblx" :key="item.CODNAME" :label="item.CODALIAS" :value="item.CODNAME">
                      </el-option>
                    </el-select>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">证件类型</label>
                  <div class="layui-input-inline">
                    <el-select v-model="regData.REGHANDLERCARDTYPE" filterable>
                      <el-option v-for="item in sfzjlx" :key="item.CODNAME" :label="item.CODALIAS" :value="item.CODNAME">
                      </el-option>
                    </el-select>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">家属姓名<span class="text-danger">*</span></label>
                  <div class="layui-input-inline">
                    <el-input v-model="regData.REGHANDLERNAME"></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">证件号码</label>
                  <div class="layui-input-inline">
                    <el-input v-model="regData.REGHANDLERCARDNO"></el-input>
                  </div>
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-inline" style="width:580px;">
                  <label class="layui-form-label">详细地址</label>
                  <div class="layui-input-inline">
                    <el-input class="longertext" :autosize="{ minRows: 2, maxRows: 8}" placeholder="请输入详细地址" v-model="regData.REGHANDLERHOUSEHOLD">
                    </el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">联系电话<span class="text-danger">*</span></label>
                  <div class="layui-input-inline">
                    <el-input v-model="regData.REGHANDLERLINK"></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">逝者关系</label>
                  <div class="layui-input-inline">
                    <el-input v-model="regData.REGRELATION"></el-input>
                  </div>
                </div>
                <!-- </div>
              <div class="layui-form-item"> -->
              </div>
            </div>
          </fieldset>
        </fieldset>
        <fieldset class="layui-elem-field layui-field-title">
          <legend>火化信息</legend>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">减免类型</label>
              <div class="layui-input-inline">
                <el-select v-model="regData.REGISKEYPOINT" :disabled="ischeck">
                  <el-option v-for="item in jmlx" :key="item.CODNAME" :label="item.CODALIAS" :value="item.CODNAME">
                  </el-option>
                </el-select>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">骨灰去向<span class="text-danger">*</span></label>
              <div class="layui-input-inline">
                <el-select v-model="regData.REGGHQX">
                  <el-option :key="item.CODNAME" :label="item.CODALIAS" :value="item.CODNAME" v-for="item in ghqx"></el-option>
                </el-select>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">接尸车辆</label>
              <div class="layui-input-inline">
                <el-cascader :options="carLics" v-model="cdhdataEexend.cardata" filterable clearable>
                </el-cascader>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">驾驶员</label>
              <div class="layui-input-inline">
                <el-select v-model="cdhdata.CDHDRIVER">
                  <el-option v-for="item in drivers" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">里程数</label>
              <div class="layui-input-inline">
                <el-input-number v-model="cdhdata.CDHMILEAGE" :min="0" style="width:150px"></el-input-number>公里
              </div>
            </div>
             <div class="layui-inline" v-if="!isAdd">
              <label class="layui-form-label">接尸地点</label>
              <div class="layui-input-inline">
                <el-select v-model="regData.REGCYADDRESS" @change="selectAddr" placeholder="请选择常用接尸地址">
                  <el-option :key="item.CodeValue" :label="item.CodeName" :value="item.CodeValue" v-for="item in commonAddr"></el-option>
                </el-select>
              </div>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGADDRESS" style="width:570px"></el-input>
              </div>
            </div>
            <div class="layui-inline" v-if="isAdd">
                <label class="layui-form-label">接尸地点</label>
                <!-- 级联式下拉框 -->
                <div class="layui-input-inline" style="width:288px">
                    <el-cascader class="dz" ref="address" v-model="arr" style="width:290px" change-on-select :options="addressOptions" @change="selectAddr">
                    </el-cascader>
                </div>
                <div class="layui-input-inline">
                    <el-input v-model="regData.REGADDRESS" style="width:500px"></el-input>
                </div>
            </div>
          </div> 

          <div class="layui-form-item">
            <div class="layui-inline" v-if="!this.isShowCharge">
              <label class="layui-form-label">冰柜号</label>
              <div class="layui-input-inline">
                <el-select v-model="regData.ICEID" filterable>
                  <!-- 存储冰柜号icenum -->
                  <el-option v-for="item in icenum" :key="item.ICEID" :label="item.ICENAME" :value="item.ICEID">
                  </el-option>
                </el-select>
              </div>
            </div>
            <!-- 不能修改的 -->
            <div class="layui-inline" v-if="this.isShowCharge">
              <label class="layui-form-label">冰柜号</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.ICENO" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">悼念厅</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.MEMNAME" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">灵堂号</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.LINNAME" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline" v-if="isshowhuo_lh">
                <label class="layui-form-label">炉型</label>
                <div class="layui-input-inline">
                    <el-select v-model="regData.REGCRETYPE" filterable>
                        <el-option v-for="item in creTypes" :key="item.value" :label="item.label " :value="item.value">
                        </el-option>
                    </el-select>
                </div>
            </div>
          </div>

          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">备注</label>
              <div class="layui-input-inline">
                <el-input class="longertextbei" v-model="regData.REGREMARK"></el-input>
              </div>
            </div>
          </div>
        </fieldset>
      </div>
      <div class="layui-form-item btnCenter">
        <el-button @click="closeDialog">取消</el-button>
        <el-button type="primary" @click="submit" :loading="this.$store.state.isloading">保存</el-button>
      </div>
    </sweet-modal>
        <!-- 详情 -->
    <sweet-modal ref="dialogInfo" class="dialog" :sweetModalMaxWidth="pageWidth">
      <h3>{{title}}</h3>
      <div :style="{maxHeight:maxHeight+'px'}" style="overflow:auto;">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 0px;">
          <legend>死者信息</legend>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">逝者类型</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGBONETYPE2" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">到馆时间</label>
              <div class="layui-input-inline">
                <el-date-picker type="datetime" v-model="regDateTimeInfo" format="yyyy-MM-dd HH:mm" readonly></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">证件类型</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGCARDTYPE" readonly></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">逝者姓名</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGNAME" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">逝者性别</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGSEXDESC" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">证件号码</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGCARDNO" readonly></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">详细地址</label>
              <div class="layui-input-inline">
                <el-input class="longertext" readonly v-model="regData.REGDETAILADDRESS">
                </el-input>
              </div>
            </div>
          </div>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">出生日期</label>
              <div class="layui-input-inline">
                <el-date-picker type="date" readonly v-model="regDataEexend.RegBirthDate"></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">死亡日期</label>
              <div class="layui-input-inline">
                <el-date-picker type="date" readonly v-model="regDataEexend.regDeathDate"></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">逝者年龄</label>
              <div class="layui-input-inline">
                <el-input readonly v-model="regData.REGAGE"></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">死亡原因</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGCAUSADESC" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">火化日期</label>
              <div class="layui-input-inline">
                <el-date-picker type="date" readonly v-model="regDataEexend.regCremationDate"></el-date-picker>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">排队序号</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGDAYNUM" readonly></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">民族</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGNATION" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">户籍类别</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGHOUSEHOLDTYPE" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">户籍地址</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGHOUSEHOLDDESC" readonly></el-input>
              </div>
            </div>
            <!-- </div>
              <div class="layui-form-item"> -->
            <div class="layui-inline">
              <label class="layui-form-label">统计地址</label>
              <div class="layui-input-inline">
                <el-input v-model="addressInfo" readonly></el-input>
              </div>
            </div>
          </div>
        </fieldset>
        <fieldset class="layui-elem-field layui-field-title">
          <legend>家属信息</legend>
          <div class="layui-field-box">
            <div class="layui-form-item">
              <div class="layui-inline">
                <label class="layui-form-label">家属姓名</label>
                <div class="layui-input-inline">
                  <el-input v-model="regData.REGHANDLERNAME" readonly></el-input>
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">家属性别</label>
                <div class="layui-input-inline">
                  <el-input v-model="regData.REGHANDSEXDESC" readonly></el-input>
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">证件号码</label>
                <div class="layui-input-inline">
                  <el-input v-model="regData.REGHANDLERCARDNO" readonly></el-input>
                </div>
              </div>
            </div>
            <div class="layui-form-item">
              <div class="layui-inline">
                <label class="layui-form-label">详细地址</label>
                <div class="layui-input-inline">
                  <el-input class="longertext" :autosize="{ minRows: 2, maxRows: 4}" readonly v-model="regData.REGHANDLERHOUSEHOLD">
                  </el-input>
                </div>
              </div>
            </div>
            <div class="layui-form-item">

              <div class="layui-inline">
                <label class="layui-form-label">联系电话</label>
                <div class="layui-input-inline">
                  <el-input v-model="regData.REGHANDLERLINK" readonly></el-input>
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">逝者关系</label>
                <div class="layui-input-inline">
                  <el-input v-model="regData.REGRELATION" readonly></el-input>
                </div>
              </div>
            </div>
          </div>
        </fieldset>
        <fieldset class="layui-elem-field layui-field-title">
          <legend>火化信息</legend>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">减免类型</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGISKEYPOINTDESC" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">骨灰去向</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGGHQXDESC" readonly></el-input>
              </div>
            </div>
          
            <div class="layui-inline">
              <label class="layui-form-label">接尸车辆</label>
              <div class="layui-input-inline">
                <el-input v-model="cdhdata.CARLIC" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">驾驶员</label>
              <div class="layui-input-inline">
                <el-input v-model="cdhdata.STANAME" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">里程数</label>
              <div class="layui-input-inline">
                <el-input v-model="cdhdata.CDHMILEAGE" :min="0" style="width:150px" readonly></el-input>公里
              </div>
            </div>
       
            <div class="layui-inline">
              <label class="layui-form-label">接尸地点</label>
              <div class="layui-input-inline">
                <el-input class="longertext" v-model="carryAreaInfo" readonly></el-input>
              </div>
            </div>
          </div>

          <div class="layui-form-item">
             <div class="layui-inline">
              <label class="layui-form-label">冰柜号</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.ICENO" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">悼念厅</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.MEMNAME" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">灵堂号</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.LINNAME" readonly></el-input>
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">炉型</label>
              <div class="layui-input-inline">
                <el-input v-model="regData.REGCRETYPEDESC" readonly></el-input>  
              </div>
            </div>
          </div>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">备注</label>
              <div class="layui-input-inline">
                <el-input class="longertextbei" v-model="regData.REGREMARK" readonly></el-input>
              </div>
            </div>
          </div>
        </fieldset>
      </div>
      <div class="layui-form-item btnCenter sweet-btn">
        <el-button @click="closeDialog">取消</el-button>
      </div>
    </sweet-modal>
    <!-- 打印火化登记表 -->
    <sweet-modal ref="print" class="dialog" :sweetModalMaxWidth="pageWidth">
      <h3>{{ printTitle }}</h3>
      <iframe :src="printUrl" style="width:1100px; height:500px;margin-top:20px;"></iframe>
    </sweet-modal>
  </div>
</template>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/common.scss";
.el-button + .el-button {
  margin-left: 0;
}

.longtext {
  width: 480px;
}

.longertext {
  width: 480px;
}
.longertextbei {
  width: 800px;
}

.sweet-btn {
  margin-top: 20px;
}

.layui-form-label[data-v-7e4f8d8c]{
  width: 82px;
}
</style>

<script>
import { ORDER } from "@/const/orderConst.js";
// import { Load, Unload, plugin } from "@/utils/scanCtrl.js";
import apiBase from "@/api/apiBase.js";
import {
  formatDate,
  timeStringToDate,
  dateStringToDate
} from "@/utils/date.js";
import sweetModal from "@/components/sweetModal";
import { codeValid } from "@/utils/IdentityCodeValid.js";
import scanWS from "@/utils/scanWebSocket.js";
import {
  MessageBox,
  Message
} from 'element-ui';
import { connects, InfoTextCallback} from "@/utils/OcxUtil.js";
import { textnum }  from "@/utils/OcxUtil.js";

window.onload = function() {
  // Load();
};
window.onunload = function() {
  Unload();
};
export default {
  name: "deadFileSearchreg",
  data() {
    return {
      noshow:false,
      //结账状态
      REGISCHECK:null,
      chdids:null,
      printUrl: null,
      printTitle: null,
      isShowCharge: true,
      pdfUrl: null,
      printUrl: null,
      //户籍所在地
      title: null,
      order: null,
      pageWidth: 1350,
      maxHeight: 550,
      ctyLists: [],
      ctyInfo: null,
      regDateTimeInfo: null,
      commonArea: null,
      isshowhuo_lh:null, //是否显示火化炉类型(临海)
      //编码类型
      commonAddr: [],
      addressOptions: [], //地址选项
      arr: [], //地址
      area: [],
      carryArea: [],
      household: [],
      causList: [],
      codeList: [],
      cause: [],
      cauinfo: [],
      szlx: [],
      szlx_backup: [],
      ytqx: [],
      ghqx: [],
      xblx: [],
      icenum: [],
      sfzjlx: [],
      gjlb: [],
      mz: [],
      whcdlx: [],
      hyzklx: [],
      zylx: [],
      zzmmlx: [],
      hjlblx: [],
      hjszdlx: [],
      jmlx: [],
      carLics: [],
      icelist: [],
      creTypes: [],
      serviceListType: [],
      drivers: [],
      addressInfo: null,
      isAdd: false,
      regData: {
        REGLBPRPID: null,// 联办预约id
        REGID: null,
        REGPRPID: null,
        REGDATE: null,
        REGTIME: null,
        REGDAYNUM: null,
        REGBONETYPE: null,
        REGCAUSA: null,
        REGCAUSASON: null,
        REGDEATHID: null,
        REGREGPROVEUNIT: null,
        REGADDRESS: null,
        REGDEATHADDRESS: null,
        REGYITIQX: null,
        REGGHQX: null,
        REGNAME: null,
        REGSEX: null,
        REGAGE: null,
        REGCARDTYPE: null,
        REGCARDNO: "",
        REGBIRTHDATE: null,
        REGNATIONALITYTYPE: null,
        REGNATION: null,
        REGCULTURALDEGREE: null,
        REGMARRIAGE: null,
        REGJOB: null,
        REGPOLITICAL: null,
        REGHOUSEHOLDTYPE: null,
        REGHOUSETYPE: null,
        REGHOUSEHOLD: null,
        REGDETAILADDRESS: null,
        REGDEATHDATE: null,
        REGISKEYPOINT: null,
        REGHANDLERNAME: null,
        REGHANDSEX: null,
        REGHANDLERCARDTYPE: null,
        REGHANDLERCARDNO: "",
        REGHANDLERHOUSEHOLD: null,
        REGHANDLERLINK: null,
        REGRELATION: null,
        REGREMARK: null,
        REGBONETYPE2: null,
        //里程数
        REGLCS: null,
        //车辆信息
        REGCLXX: [],
        //驾驶员
        REGJSY: null,
        //冰柜号
        ICENO: null,
        ICEID: null,
        //悼念厅
        MEMNAME: null,
        //灵堂号
        LINNAME: null,
        //炉型
        REGCRETYPEDESC: null,
        //炉型下拉
        REGCRETYPE: null,
        //是否联办
        REGISUSEJOINT:null,

      },
      cdhdata: {
        CARCODNAME: null,
        CDHCARID: null,
        CARLIC: null,
        CDHDRIVER: null,
        STANAME: null,
        CDHMILEAGE: null
      },
      cdhdataEexend: {
        cardata: []
      },
      regDataEexend: {
        regDeathDate: null,
        regDataTime: null,
        RegBirthDate: null,
        //火花日期
        regCremationDate: null
      },
      carryAreaInfo: null,
      isShowPdf: false,
      pdfPrintID: null,
      //火化日期
      regCremationDate: null,
      cardInfo: [],
      ischeck: null,
    };
  },
  methods: {
    //获取编码
    getCode() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Registration.QueryAllCode,
        res => {
          this.codeList = res.data.content;
          for (var i in this.codeList) {
            switch (this.codeList[i].CTPID) {
              case "逝者类型":
                this.szlx = this.codeList[i].Cods;
                this.szlx.map((item)=>{
                if(item.CODNAME=="异地火化"){
                  item.disabled=true
                }
                })
                this.regData.REGBONETYPE = this.szlx[0].CODNAME;
                break;
              case "遗体去向":
                this.ytqx = this.codeList[i].Cods;
                this.regData.REGYITIQX = this.ytqx[0].CODNAME;
                break;
              case "骨灰去向":
                this.ghqx = this.codeList[i].Cods;
                this.regData.REGGHQX = this.ghqx[0].CODNAME;
                break;
              case "性别类型":
                this.xblx = this.codeList[i].Cods;
                break;
              case "身份证件类型":
                this.sfzjlx = this.codeList[i].Cods;
                this.regData.REGCARDTYPE = this.sfzjlx[0].CODNAME;
                break;
              case "国籍类别":
                this.gjlb = this.codeList[i].Cods;
                break;
              case "民族":
                this.mz = this.codeList[i].Cods;
                this.regData.REGNATION = this.mz[0].CODNAME;
                break;
              case "文化程度类型":
                this.whcdlx = this.codeList[i].Cods;
                break;
              case "婚姻状况类型":
                this.hyzklx = this.codeList[i].Cods;
                break;
              case "职业类型":
                this.zylx = this.codeList[i].Cods;
                break;
              case "政治面貌类型":
                this.zzmmlx = this.codeList[i].Cods;
                break;
              case "户籍类别类型":
                this.hjlblx = this.codeList[i].Cods;
                break;
              case "户籍所在地类型":
                this.hjszdlx = this.codeList[i].Cods;
                break;
              case "减免类型":
                this.jmlx = this.codeList[i].Cods;
                this.regData.REGISKEYPOINT = this.jmlx[0].CODNAME;
                break;
              default:
            }
          }
        }
      );
    },
    //出生日期改变触发
    birthdaydata(val){
      this.regData.REGBIRTHDATE = formatDate(val, "yyyyMMdd");
      let now = new Date();
      var nY = now.getFullYear();
      var nM = now.getMonth() + 1;
      var nD = now.getDate();
      if (val) {
        var dY = val.getFullYear();
        var dM = val.getMonth() + 1;
        var dD = val.getDate();
        var adjust;
        if (nM * 31 + nD >= dM * 31 + dD) {
          adjust = 0;
        } else adjust = -1;
        this.regData.REGAGE = now.getFullYear() - val.getFullYear() + adjust;
      }
    },
    //证件号码改变触发
    identityNumber(val){
       if (!codeValid(val)) {
          return;
        }
      this.regDataEexend.RegBirthDate = null;
      if (val === null || val === undefined) return;
      var strDate;
      if (this.regData.REGCARDNO.length === 15)
        strDate = "19" + this.regData.REGCARDNO.substr(6, 6);
      else if (this.regData.REGCARDNO.length === 18)
        strDate = this.regData.REGCARDNO.substr(6, 8);
      else return;
      this.regDataEexend.RegBirthDate = dateStringToDate(strDate);
      this.birthdaydata(this.regDataEexend.RegBirthDate);
    },
    //获取常用地址
    getCommonAddr() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Code.GetCommonAddress,
        res => {
          this.commonAddr = res.data.content;
        }
      );
    },
    selectAddr() {
      // this.regData.REGADDRESS = this.regData.REGCYADDRESS;
      if (this.isAdd == false) {
          if (this.regData.REGCYADDRESS != null) {
              this.regData.REGADDRESS = this.regData.REGCYADDRESS + "";
          }
      } else {
          this.$nextTick(() => {
              let text = this.$refs.address.currentLabels + "";
              let arr = text.split(",");
              text = arr.join("");
              this.$set(this.regData, "REGADDRESS", text);
          }) 
      }
    },
    getAddr() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Code.GetAddressMap,
        res => {
          let cardata = res.data.content;
          this.area = cardata.map(item => ({
            value: item.ADDID,
            label: item.ADDNAME,
            ADDLEVEL: item.ADDLEVEL,
            ADDTOPID: item.ADDTOPID,
            children: item.Children.map(itemStr => ({
              value: itemStr.ADDID,
              label: itemStr.ADDNAME,
              ADDLEVEL: itemStr.ADDLEVEL,
              ADDTOPID: itemStr.ADDTOPID
            }))
          }));
        }
      );
    },
    
    //获取死亡原因
    getCausa() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Code.GetCausa, res => {
        let caudata = res.data.content;
        this.cause = caudata.map(item => ({
          label: item.CAENAME,
          value: item.CAEID,
          children: item.Caus.map(itemCau => ({
            label: itemCau.CAUNAME,
            value: itemCau.CAUID
          }))
        }));
        if (this.cause[0] && this.cause[0].children[0])
          this.cauinfo = [this.cause[0].value, this.cause[0].children[0].value];
      });
    },
    //获取服务类型
    getServiceTypes() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Code.GetYitiqx, res => {
        this.serviceListType = res.data.content;
      });
    },
    //获取司机
    getDrivers() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Staff.QueryDriver, res => {
        let driverData = res.data.content,
          legendsDrivers = driverData.map(item => ({
            label: item.STANAME,
            value: item.STAID
          }));
        this.drivers = legendsDrivers;
      });
    },
    //获取户籍所在地
    getHousehold() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Code.GetHousehold, res => {
        let cardata = res.data.content;
        this.household = cardata.map(item => ({
          label: item.StaName,
          value: item.StaCode,
          children: item.List_Cty.map(itemCty => ({
            label: itemCty.CtyName,
            value: itemCty.CtyCode,
            children: itemCty.List_Cnt.map(itemCnt => ({
              label: itemCnt.CntName,
              value: itemCnt.CntCode
            }))
          }))
        }));
      });
    },
    //根据编码获取所在地
    getHouseholdInfo(code) {
      let data = {
        CODE: code
      };
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Registration.GetHousehold,
        res => {
          let ctydata = res.data.content;
          this.ctyLists = [ctydata.StaCode, ctydata.CtyCode, ctydata.CntCode];
          if (ctydata)
            this.ctyInfo =
              ctydata.StaName + "/" + ctydata.CtyName + "/" + ctydata.CntName;
        }
      );
    },
    //获取预约信息
    getReserveInfo(id) {
      let data = {
        PRPID: id
      };
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Reserve.DetailPhoneReserve,
        res => {
          let resdata = res.data.content;
          this.regData.REGPRPID = id;
          this.regData.REGDAYNUM = resdata.PRPDAYNUM;
          this.regData.REGHANDLERNAME = resdata.PRPLINKMAN;
          this.regData.REGNAME = resdata.PRPDEADNAME;
          this.regData.REGPRPID = resdata.PRPID;
          this.regData.REGADDRESS = resdata.PRPCORPSEADDRESS;
          this.regData.REGHANDLERLINK = resdata.PRPLINKPHONE;
          this.regData.REGYITIQX = resdata.PRPYITIQX;
          this.regData.REGREMARK = resdata.PRPDESCRIBE;
          this.regData.REGSEX = resdata.PRPDEADSEX;
          this.regData.REGAGE = resdata.PRPDEADAGE;
          // PRPCORPSEADDRESS
          this.regData.REGCYADDRESS = resdata.PRPADDID;
          if (resdata.Cdh) {
            this.cdhdataEexend.cardata = [
              resdata.Cdh.CARCODNAME,
              resdata.Cdh.CDHCARID
            ];
            this.cdhdata.CDHDRIVER = resdata.Cdh.CDHDRIVER;
          }
        }
      );
    },
    //获取车辆信息
    getCar() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Car.QueryCarByType,
        res => {
          let cardata = res.data.content;
          let legendsCarData = cardata.map(item => ({
            label: item.CodeName,
            value: item.CodeValue,
            children: item.list_Cars.map(caritem => ({
              label: caritem.CARLIC,
              value: caritem.CARID
            }))
          }));
          this.carLics = legendsCarData;
        }
      );
    },
    //获取冰柜信息
    getIce() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Ice.QueryIceByIceArea,
        res => {
          let icedata = res.data.content;
          let IceData = icedata.map(item => ({
            label: item.ICANAME,
            value: item.ICAID,
            children: item.list_Ices.map(iceitem => ({
              label: iceitem.ICENO,
              value: iceitem.ICEID
            }))
          }));
          this.icelist = IceData;
        }
      );
    },
    //获取未使用冰柜信息
    getnoIce(id){
      let data = {
        ICEID: id
      };
      apiBase.DoService(
        data,
        apiBase.getApiAdress().IceUse.QueryIceBynotuse,
        res => {
          this.icenum = res.data.content;
        }
      )
    },
    //获取火化炉类型
    getCreTypes() {
      apiBase.DoService(
        {},
        apiBase.getApiAdress().Code.GetCremationType,
        res => {
          let creTypeData = res.data.content,
            legendsCreData = creTypeData.map(item => ({
              label: item.CodeName,
              value: item.CodeValue
            }));
          this.creTypes = legendsCreData;
        }
      );
    },
    // 判断接尸地址是否使用二级级联 true/false--------------
    getNew() {
        let data = {};
        apiBase.DoService(
            data,
            apiBase.getApiAdress().Param.GetIsCorpseUseCascade,
            res => {
                this.isAdd = res.data.content;
                if (this.isAdd == false) {
                    //获取常用地址
                    let data = {};
                    apiBase.DoService(
                        data,
                        apiBase.getApiAdress().Code.GetCommonAddress,
                        res => {
                            this.commonAddr = res.data.content;
                        }
                    );
                } else {
                    this.getcityType();
                }
            }
        );
    },
    //获取预约地址 (多级)
    getcityType() {
        // 获取级联选择
        apiBase.DoService(
            {},
            apiBase.getApiAdress().Reserve.GetBorough,
            res => {
                let datas = res.data.content;
                this.addressOptions = datas.map(item => ({
                    label: item.AFCADDRESS,
                    value: item.AFCID,
                    children: this.restructur(item.ListFulafc)
                }));
            }
        );
    },
    restructur(value) {
        let arr = JSON.parse(JSON.stringify(value));
        var data = [];
        arr.forEach(item => {
            if (item.ListFulafc.length > 0) {
                data.push({
                    label: item.AFCADDRESS,
                    value: item.AFCID,
                    children: this.restructur(item.ListFulafc)
                });
            } else {
                data.push({
                    label: item.AFCADDRESS,
                    value: item.AFCID
                });
            }
        });
        return data;
    },
    //初始化下拉框数据
    initSelectData() {
      //初始化下拉框数据
      this.getCode();
      this.getCausa();
      this.getHousehold();
      this.getCar();
      this.getCreTypes();
      this.getIce();
      this.getServiceTypes();
      this.getDrivers();
      this.getAddr();
      // this.getnoIce();
    },
    //打开页面
    open(order,id,REGISCHECK) {
      if(REGISCHECK === "B"){
        this.ischeck = true;
      }else{
        this.ischeck = false;
      }
      this.order = order;
      this.maxHeight = window.innerHeight - 240;
      // this.getCommonAddr();
      this.getNew(); //地址
      //清理数据
      this.dataRepeat();
      switch (this.order) {
        case ORDER.MODIFY://修改
          if(ORDER.Highmeter == 20){
             connects();
          }
          this.isShowCharge = true;
          this.$refs.dialog.open();
          this.initSelectData();
          this.title = "登记修改";
          this.dataInfo(id);
          break;
        case ORDER.INFO://详情
          this.$refs.dialogInfo.open();
          this.getAddr();
          this.title = "登记详情";
          this.dataInfo(id);
          break;
        case '打印火化登记表':
          this.printsl(id)
          break;
        default:
      }
    },
    //提交
    submit(checkout = false) {
      switch (this.order) {
        case ORDER.MODIFY://修改
          this.dataModify(checkout);//登记修改
          break;
        default:
      }
    },
    //取消按钮
    closeDialog() {
      if (
        this.order === ORDER.SELFREGISTER ||
        this.order === ORDER.REGISTER ||
        this.order === ORDER.MODIFY ||
        this.order === ORDER.BODYOUTAGE ||
        this.order === ORDER.BODYOUTAGES
      )
        this.$refs.dialog.close();
      else if (this.order === ORDER.INFO) this.$refs.dialogInfo.close();
    },
   
   
    //登记修改
    dataModify(checkout = false) {
      this.regData.REGADDID = this.carryArea[this.carryArea.length - 1];
      if(this.regData.REGISUSEJOINT===""){
             this.regData.REGISUSEJOINT='A'
          }
      let data = JSON.parse(JSON.stringify(this.regData));
      if (this.cdhdata.CDHCARID) {
        data.Cdh = {
          CDHCARID: this.cdhdata.CDHCARID,
          CDHMILEAGE: this.cdhdata.CDHMILEAGE,
          CDHDRIVER: this.cdhdata.CDHDRIVER   //null
        };
      }
      if (
        data.REGCARDTYPE === "内地居民身份证" &&
        data.REGBONETYPE === "有名尸"
      ) {
        if (!codeValid(data.REGCARDNO)) {
          this.$message({
            type: "error",
            message: "逝者身份证号码有误！"
          });
          return;
        }
      }
      if (
        data.REGHANDLERCARDTYPE === "内地居民身份证" &&
        data.REGHANDLERCARDNO.length > 0
      ) {
        if (!codeValid(data.REGHANDLERCARDNO)) {
          this.$message({
            type: "error",
            message: "家属身份证号码有误！"
          });
          return;
        }
      }
      if (this.isAdd == true) {
          //接尸地址
          data.REGCYADDRESS = this.arr[this.arr.length - 1];
      }
      // this.$store.state.isloading = true;
      //火化登记修改
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Registration.ModifyCremationRegistration,
        res => {
          this.REGISCHECK = res.data.content.REGISCHECK;
          this.chdids = res.data.content.CHDID;
          this.closeDialog();//关闭页面
          this.$message({
            type: "success",
            message: "修改成功!"
          });
          this.refreshData();
          this.openDialog();
        }
      );
    },
    
   //登记详情
    dataInfo(id) {
      let data = {
        REGID: id
      };
      apiBase.DoService (
        data,
        apiBase.getApiAdress().Registration.DetailCremationRegistration,
        res => {
          this.regData.REGLBPRPID = res.data.content.REGLBPRPID;//联办预约id
          this.regData.REGPRPID = res.data.content.REGPRPID;//预约id 
          this.regData.REGBONETYPE = res.data.content.REGBONETYPE;//逝者类型
          if(res.data.content.REGBONETYPE=="异地火化") {
          this.noshow=true
          }else{
          this.noshow=false
          }
          this.regData.REGBONETYPE2 = res.data.content.REGBONETYPEDESC;
          this.regData.REGSEX = res.data.content.REGSEX;//逝者性别
          this.regData.REGSEXDESC = res.data.content.REGSEXDESC;
          this.regData.REGCARDTYPE = res.data.content.REGCARDTYPE;//证件类型
          this.regData.REGNAME = res.data.content.REGNAME;//逝者姓名
          this.regData.REGCARDNO = res.data.content.REGCARDNO;//证件号码
          this.regData.REGDETAILADDRESS = res.data.content.REGDETAILADDRESS;//详细地址
          this.regData.REGAGE = res.data.content.REGAGE;//逝者年龄
          this.regData.REGDAYNUM = res.data.content.REGDAYNUM;//排队序号
          this.regData.REGNATION = res.data.content.REGNATION;//民族
          this.regData.REGHOUSEHOLDTYPE = res.data.content.REGHOUSEHOLDTYPE;//户籍类别
          this.regData.REGHANDSEX = res.data.content.REGHANDSEX;//家属性别
          this.regData.REGHANDSEXDESC = res.data.content.REGHANDSEXDESC;//详情中的家属性别
          this.regData.REGHANDLERCARDTYPE = res.data.content.REGHANDLERCARDTYPE;//证件类型
          this.regData.REGHANDLERNAME = res.data.content.REGHANDLERNAME;//家属姓名
          this.regData.REGHANDLERCARDNO = res.data.content.REGHANDLERCARDNO;//证件号码
          this.regData.REGHANDLERHOUSEHOLD = res.data.content.REGHANDLERHOUSEHOLD;//详细地址
          this.regData.REGHANDLERLINK = res.data.content.REGHANDLERLINK;//联系电话
          this.regData.REGRELATION = res.data.content.REGRELATION;//逝者关系
          this.regData.REGISKEYPOINT = res.data.content.REGISKEYPOINT;//减免类型
          this.regData.REGISKEYPOINTDESC = res.data.content.REGISKEYPOINTDESC;//详情中的减免类型
          this.regData.REGGHQX = res.data.content.REGGHQX;//骨灰去向
          this.regData.REGGHQXDESC = res.data.content.REGGHQXDESC;//详情骨灰去向
          this.regData.REGCYADDRESS = res.data.content.REGCYADDRESS;//接尸地址  常用地址
          if(this.isAdd){
            this.arr = [res.data.content.REGCYADDRESS];
          }
          this.regData.REGADDRESS = res.data.content.REGADDRESS; //接运地点
          this.regData.REGREMARK = res.data.content.REGREMARK;//备注
          this.regData.ICENO = res.data.content.ICENO;//冰柜号
          this.regData.MEMNAME = res.data.content.MEMNAME;//悼念厅
          this.regData.LINNAME = res.data.content.LINNAME;//灵堂号    
          this.regData.REGCRETYPEDESC = res.data.content.REGCRETYPEDESC;//炉型    
          this.regData.REGCRETYPE = res.data.content.REGCRETYPE;//炉型下拉    
          if(res.data.content.REGISUSEJOINT===""){
             this.regData.REGISUSEJOINT='A'
          }
          this.regData.REGISUSEJOINT = res.data.content.REGISUSEJOINT;//是否联办
          this.regData.REGID = res.data.content.REGID;
          this.regData.REGHOUSEHOLDDESC = res.data.content.REGHOUSEHOLDDESC;//详情中的户籍地址

          this.regData.REGCAUSADESC = res.data.content.REGCAUSADESC;//详情中的死亡原因

          this.regData.REGCAUSA = res.data.content.REGCAUSA;
          this.regData.REGCAUSASON = res.data.content.REGCAUSASON;
          this.regData.REGHOUSEHOLD = res.data.content.REGHOUSEHOLD;//逝者户籍所在地
          this.regData.REGADDID = res.data.content.REGADDID;

          this.carryAreaInfo = this.regData.REGADDRESS;
          this.regDateTimeInfo = timeStringToDate(//详情中的到馆时间
            res.data.content.REGTIME,
            res.data.content.REGDATE
          );
          this.regDataEexend.regDataTime = timeStringToDate(//修改中的到馆时间
            res.data.content.REGTIME,
            res.data.content.REGDATE
          );
         
          this.regDataEexend.RegBirthDate = dateStringToDate(//出生日期
            res.data.content.REGBIRTHDATE 
          );
        
          this.regDataEexend.regDeathDate = dateStringToDate(//死亡时间
            res.data.content.REGDEATHDATE
          );
          this.regDataEexend.regCremationDate = dateStringToDate(//火化日期
            res.data.content.REGCREMATIONDATE
          );
          if (this.regDataEexend.regCremationDate == null) {
            this.regDataEexend.regCremationDate = new Date();
          }
          let cdhdata = res.data.content.Cdh;
          if (cdhdata) {
            this.cdhdataEexend.cardata = [cdhdata.CARCODNAME, cdhdata.CDHCARID];
            this.cdhdata.CARLIC = cdhdata.CARLIC;
            this.cdhdata.CDHDRIVER = cdhdata.CDHDRIVER;
            this.cdhdata.CDHMILEAGE = cdhdata.CDHMILEAGE;
            this.cdhdata.STANAME = cdhdata.STANAME;
            if (
              !this.drivers.some(item => {
                return item.value == cdhdata.CDHDRIVER;
              })
            ) {
              this.drivers.push({
                label: cdhdata.STANAME,
                value: cdhdata.CDHDRIVER
              });
            }
            let findarry = this.carLics.filter(item => {
              return item.value === cdhdata.CARCODNAME;
            });
            if (findarry.length > 0) {
              let seachCarType = findarry[0];
              if (
                !seachCarType.children.some(item => {
                  return item.value === cdhdata.CDHCARID;
                })
              )
                seachCarType.children.push({
                  label: cdhdata.CARLIC,
                  value: cdhdata.CDHCARID
                });
            }
          };
          //获取冰柜号，放在这里为了方便取到ICEID
          this.getnoIce(res.data.content.ICEID);
          //初始化死亡原因
          this.cauinfo = [this.regData.REGCAUSA, this.regData.REGCAUSASON];
          //初始化户籍地址
          this.getHouseholdInfo(this.regData.REGHOUSEHOLD);
          let currentArea = [];
          let addrId = this.regData.REGADDID;
          let addrName = null;
          this.area.forEach(function(value, index, arr) {
            value.children.forEach(function(v, i, a) {
              if (v.value == addrId) {
                currentArea.push(v.ADDTOPID, v.value);
                addrName = value.label + " / " + v.label;
              }
            });
          });
          this.carryArea = currentArea;
          this.addressInfo = addrName;
          //多级地址选择详情   isaddress
          if (this.isAdd == true && this.regData.REGCYADDRESS) {
              apiBase.DoService(
                  { AFCID: this.regData.REGCYADDRESS },
                  apiBase.getApiAdress().Reserve.GetBoroughByID,
                  res => {
                      this.arr = res.data.content; //地址选择详情
                  }
              );
          }
        }
      );
    },
    //打印火化清单
    printsl(id){
       let data = {
            CHDID: id
          };
          apiBase.DoService(data, apiBase.getApiAdress().Pdf.PrintReg, res => {
            this.printUrl = res.data.content.PDFNAME;
            this.printTitle = "火化登记表打印";
            this.$refs.print.open();
          });
    },
    refreshData() {
      this.$emit("refreshData");
    },
    //数据重置
    dataRepeat() {
      this.arr = []; //地址选择清空
      this.cardInfo = [];
      Object.assign(this.$data.regData, this.$options.data().regData);
      Object.assign(
        this.$data.regDataEexend,
        this.$options.data().regDataEexend
      );
      Object.assign(this.$data.cdhdata, this.$options.data().cdhdata);
      Object.assign(
        this.$data.cdhdataEexend,
        this.$options.data().cdhdataEexend
      );
      this.regDataEexend.regDataTime = null;
      this.regData.ICENO = null;
      this.causList = [];
      this.ctyLists = [];
      this.cauinfo = [];
      this.carryArea = [];
      if (this.order === ORDER.SELFREGISTER) {
        this.cdhdataEexend.cardata = ["自送", null];
      }
      if (this.$store.state.orginCode) {
        this.getHouseholdInfo(this.$store.state.orginCode);
      }
    },
    openDialog() {
      //个性化
      let data = {};
      //火化登记是否结账
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Param.GetCremationregIsCheckout,
        res => {
          var isInd = res.data.content;
          if (isInd) {
            if(this.REGISCHECK === 'A'){
              this.$confirm("是否直接进行划价?", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning"
            })
              .then(() => {
                 this.$refs.checkadd.open(ORDER.CHEMODIFY, this.chdids);
              })
              .catch(() => {
                // this.submit(false);
              });
            }else{
              this.$refs.dialog.close();
            }
          
          }else {
             this.$refs.dialog.close();
          }
        }
      );
    },
  },
  components: {
    sweetModal
  },
  computed: {
    testval: {
      get: function() {
        if (
          this.regData.REGCARDNO === null ||
          this.regData.REGCARDNO === undefined
        )
          return null;
      },
      set: function(val) {
      }
    }
   
  },
  created() {
   let data = {};
    apiBase.DoService(
      data,
      apiBase.getApiAdress().Param.GetIsIchbyRegistration,
      res => {
        ORDER.ICENUM = res.data.content;
      }
    )
    apiBase.DoService(
        {},
        apiBase.getApiAdress().Param.GetIsCremationFurnace,
        res => {
            this.isshowhuo_lh = res.data.content;
        }
    );
  },
 
  watch: {
      //死亡日期
    "regDataEexend.regDeathDate": function(val) {
      this.regData.REGDEATHDATE = formatDate(val, "yyyyMMdd");
    },
    // 到馆时间
    "regDataEexend.regDataTime": function(val) {
      this.regData.REGDATE = formatDate(val, "yyyyMMdd");
      this.regData.REGTIME = formatDate(val, "hhmmss");
    },
    // 火化日期
    "regDataEexend.regCremationDate":function(val) {
      this.regData.REGCREMATIONDATE = formatDate(val, "yyyyMMdd");
    },
    // 接尸车辆
    "cdhdataEexend.cardata": function(val) {
      this.cdhdata.CDHCARID = val[1];
    },
    // 死亡原因
    cauinfo: function(val) {
      this.regData.REGCAUSA = val[0];
      this.regData.REGCAUSASON = val[1];
    },
    // 户籍地址
    ctyLists: function(val) {
      this.regData.REGHOUSEHOLD = val[2];
    }
  }
 
};
</script>
